package 算法.leetcode.labuladong.数组和链表;

import 算法.leetcode.offer.base.ListNode;

/**
 * @author lchenglong
 * @date 2022/6/16
 */
public class 链表的中间节点 {
    class Solution {
        public ListNode middleNode(ListNode head) {
            ListNode fast = head,slow = head;
            while (fast!=null && fast.next!=null){
                fast = fast.next.next;
                slow = slow.next;
            }
            return slow;
        }
    }
}
